import request from '@/utils/request'

// 获取部门列表
export function getDepartments () {
  return request({
    url: '/company/department'
  })
}

// 获取部门负责人
export function getEmployeesSimple () {
  return request({
    url: '/sys/user/simple'
  })
}

// 新增子部门
/**
*
* @param { code,introduce,manger,name,pid} data
* @returns
*/
export function addDepartments (data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}
// 编辑子部门
/**
*
* @param { code,introduce,manger,name,pid} data
* @returns
*/
export function editDepartments (data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}

// 获取部门详情
export function getDepartmentsDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 删除子部门
/**
* @desription :删除部门
* @param { * } id 点击按钮当前项的id
* @returns {*}
*/
export function deleteDepartments (id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

